<%@ page import="com.qf.om.entity.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.qf.om.entity.Admin" %><%--
  Created by IntelliJ IDEA.
  User: JIN PANGZI
  Date: 2022/3/30
  Time: 20:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fu" %>
<html>
<head>
    <title>学生列表</title>
</head>
<body>
<h1>学生列表</h1>
<%--<%--%>
<%--    //将数据从本地提取出来，类似小程序的Storage--%>
<%--    List<Student> stus = (List<Student>) request.getAttribute("stus");--%>
<%--    Admin admin = (Admin) session.getAttribute("login_user");--%>
<%--%>--%>
<table border="1">
    <tr>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>操作</th>
    </tr>
    <%--将数据从本地提取出来，类似小程序的Storage--%>
    <c:if test="${not empty stus}">
        <c:forEach items="${stus}" var="stu">
            <tr>
                <td>${stu.name}
                </td>
                <td>${stu.age}
                </td>
                <td>${stu.sex == 1 ? "男" : "女" }
                </td>
                <td>
                    <c:if test="${fu:contains(login_user.powers, '3')}">
                        <button onclick="location.href='deletestudent?dname=${stu.name}'">删除</button>
                    </c:if>
                </td>
            </tr>

        </c:forEach>
    </c:if>
    <button onclick="location.href='index.jsp'">操作完成</button>
</table>
</body>
</html>
